<template>
	<div class="aui-card--fill">
		<div class="mod-sys__role ">
			<div class="userBox">
			  <div class="userListText">菜单管理</div>
			    <el-button class="newAdd" v-if="$hasPermission('sys:menu:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
			</div>
			<el-table v-loading="dataListLoading" :data="dataList" row-key="id" border style="width: 100%;">
			  <el-table-column prop="name" :label="$t('menu.name')" header-align="center" min-width="150"></el-table-column>
			  <el-table-column prop="icon" :label="$t('menu.icon')" header-align="center" align="center">
			    <template slot-scope="scope">
			      <svg class="icon-svg" aria-hidden="true"><use :xlink:href="`#${scope.row.icon}`"></use></svg>
			    </template>
			  </el-table-column>
			  <el-table-column prop="type" :label="$t('menu.type')" header-align="center" align="center">
			    <template slot-scope="scope">
			      <el-tag v-if="scope.row.type === 0" size="small">{{ $t('menu.type0') }}</el-tag>
			      <el-tag v-else size="small" type="info">{{ $t('menu.type1') }}</el-tag>
			    </template>
			  </el-table-column>
			  <el-table-column prop="sort" :label="$t('menu.sort')" header-align="center" align="center"></el-table-column>
			  <el-table-column prop="url" :label="$t('menu.url')" header-align="center" align="center" width="150" :show-overflow-tooltip="true" ></el-table-column>
			  <el-table-column prop="permissions" :label="$t('menu.permissions')" header-align="center" align="center" width="150" :show-overflow-tooltip="true"></el-table-column>
			  <el-table-column  :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
			    <template slot-scope="scope">
			      <el-button v-if="$hasPermission('sys:menu:update')" type="primary" round size="mini" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>
			      <el-button v-if="$hasPermission('sys:menu:delete')" type="danger" round size="mini" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>
			    </template>
			  </el-table-column>
			</el-table>
			<!-- 弹窗, 新增 / 修改 -->
			<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
		</div>
	</div>	
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './menu-add-or-update'
export default {
  mixins: [mixinViewModule],
  data () {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/sys/menu/list',
        deleteURL: '/sys/menu'
      }
    }
  },
  components: {
    AddOrUpdate
  }
}
</script>
<style scoped>
  .card-Box{
    width: 100%;
    height:10vh;
    background-color: #fff;
    border-radius: 10px;
    margin-bottom: 1.9vh;
    padding: 3vh 0 3vh 3vw;
    box-sizing: border-box;
  }
  .aui-card--fill{
    width: 100%;
    /* height: 750px; */
    padding: 1.8vh 2vw 1.8vh 2vw;
    background-color: #fff;
    border-radius: 10px;
  }
  .selectRegion{
    width: 100%;
    height: 10vh;
  }
  /* .mod-sys__user{
    position: relative;
  } */
  .search{
    margin-left: 6.25vw;
    width: 5.9vw;
    height: 3.8vh;
  }
  .reset{
    width: 5.9vw;
    height: 3.8vh;
    margin-left: 1.875vw;
    background-color: rgba(180, 196, 209, 1);
    border: 1px solid rgba(180, 196, 209, 1);
  }
  .userBox{
    display: flex;
    position: relative;
    width: 100%;
    height: 3vh;
    margin-bottom: 1.9vh;
  }
  .userListText{
    width: 5vw;
    height: 3vh;
    line-height: 3vh;
    font-size: 16px;
  }
  .newAdd{
    position: absolute;
    right: 0;
    width: 5.9vw;
    height: 3vh;
    padding: 0;
  }
  .aui-card--fill>>>.el-table__fixed-right{
	height: 100%!important;  
  }
</style>
